package com.pt.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.pt.entity.Torrent;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface TorrentMapper extends BaseMapper<Torrent> {
    
    @Update("UPDATE torrent SET seeders = #{seeders}, leechers = #{leechers} WHERE id = #{torrentId}")
    int updatePeerCount(@Param("torrentId") Long torrentId, @Param("seeders") int seeders, @Param("leechers") int leechers);
    
    @Update("UPDATE torrent SET finished = finished + 1 WHERE id = #{torrentId}")
    int incrementFinished(@Param("torrentId") Long torrentId);
} 